package vn.fsoft.gst.service;
/**
*
* @author MinhNT
*
*/
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import vn.fsoft.gst.dao.DirectorateDAO;
import vn.fsoft.gst.domain.Directorate;

/**
 * DirectorateServiceImp implements DirectorateService *
 */
/**
 */
@Service
public class DirectorateServiceImp implements DirectorateService {
    /**
    *@category Autowired DirectorateDAO
    */
    @Autowired
    private DirectorateDAO directorateDAO;
    /**
     * @category add one directorate to database
     * @param directorate
     * input directorate
     * @return
     * output true or false
     */
    @Transactional
    public final Boolean add(final Directorate directorate) {
        return directorateDAO.add(directorate);
    }
    /**
     *@category update one directorate to database
     * @param directorate
     * input directorate
     * @return
     * return true or false
     */
    @Transactional
    public final Boolean edit(final Directorate directorate) {
        return directorateDAO.edit(directorate);
    }
    /**
     *@category get directorate by Id
     * @param id
     * input id of directorate
     * @return
     * return Directorate
     */
    @Transactional
    public final Directorate getDirectorateById(final int id) {
        return directorateDAO.getDirectorateById(id);
    }
    /**
    *
    *@category get list directorate by Id from database
    * @param orgID
    * input orgID of Organisation
    * @return
    * return list all directorate by orgID
    */
    @Transactional
    public final List<Directorate> getListDirectorateByOrgID(
                                    final int orgID) {
        return directorateDAO.getListDirectorateByOrgID(orgID);
    }
    /**
    *
    *@category active directorate by Id
    * @param directorateID
    * input1 directorateID of directorate
    * @param active
    * status of directorate
    * @return
    * return true or false
    */
    @Transactional
    public final Boolean setActiveDirectorate(final int directorateID,
                                                final Boolean active) {
        return
                directorateDAO.setActiveDirectorate(directorateID, active);
    }
}
